/*     */ package com.zimbra.cs.store;
/*     */ 
/*     */ import com.zimbra.cs.mailbox.Mailbox;
/*     */ import java.io.IOException;
/*     */ import java.io.Serializable;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public abstract class MailboxBlob
/*     */ {
/*     */   private final Mailbox mailbox;
/*     */   private final int itemId;
/*     */   private final int revision;
/*     */   private final String locator;
/*     */   protected Long size;
/*     */   protected String digest;
/*     */   
/*     */   public static class MailboxBlobInfo
/*     */     implements Serializable
/*     */   {
/*     */     private static final long serialVersionUID = 6378518636677970767L;
/*     */     public String accountId;
/*     */     public int mailboxId;
/*     */     public int itemId;
/*     */     public int revision;
/*     */     public String locator;
/*     */     public String digest;
/*     */     
/*     */     public MailboxBlobInfo(String accountId, int mailboxId, int itemId, int revision, String locator, String digest)
/*     */     {
/*  40 */       this.accountId = accountId;
/*  41 */       this.mailboxId = mailboxId;
/*  42 */       this.itemId = itemId;
/*  43 */       this.revision = revision;
/*  44 */       this.locator = locator;
/*  45 */       this.digest = digest;
/*     */     }
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   protected MailboxBlob(Mailbox mbox, int itemId, int revision, String locator)
/*     */   {
/*  58 */     this.mailbox = mbox;
/*  59 */     this.itemId = itemId;
/*  60 */     this.revision = revision;
/*  61 */     this.locator = locator;
/*     */   }
/*     */   
/*     */   public int getItemId() {
/*  65 */     return this.itemId;
/*     */   }
/*     */   
/*     */   public int getRevision() {
/*  69 */     return this.revision;
/*     */   }
/*     */   
/*     */   public String getLocator() {
/*  73 */     return this.locator;
/*     */   }
/*     */   
/*     */   public String getDigest() throws IOException {
/*  77 */     if (this.digest == null) {
/*  78 */       this.digest = getLocalBlob().getDigest();
/*     */     }
/*  80 */     return this.digest;
/*     */   }
/*     */   
/*     */   public MailboxBlob setDigest(String digest) {
/*  84 */     this.digest = digest;
/*  85 */     return this;
/*     */   }
/*     */   
/*     */   public long getSize() throws IOException {
/*  89 */     if (this.size == null) {
/*  90 */       this.size = Long.valueOf(getLocalBlob().getRawSize());
/*     */     }
/*  92 */     return this.size.longValue();
/*     */   }
/*     */   
/*     */   public MailboxBlob setSize(long size) {
/*  96 */     this.size = Long.valueOf(size);
/*  97 */     return this;
/*     */   }
/*     */   
/*     */   public Mailbox getMailbox() {
/* 101 */     return this.mailbox;
/*     */   }
/*     */   
/*     */   public abstract Blob getLocalBlob() throws IOException;
/*     */   
/*     */   public String toString()
/*     */   {
/* 108 */     return this.mailbox.getId() + ":" + this.itemId + ":" + this.revision + "[" + getLocator() + "]";
/*     */   }
/*     */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/store/MailboxBlob.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */